<template>
  <h3>current component: a</h3> 
  <h3>count: {{count}} <button @click="count++">+1</button></h3>
</template>

<script setup>
  const count = ref(0)
  
  onActivated(() => {
    console.log('进来了')
  })
  onDeactivated(() => {
    console.log('出去了')
  })
</script>